package jy.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Tuser entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tuser", catalog = "jlubank", uniqueConstraints = @UniqueConstraint(columnNames = "NAME"))
public class Tuser implements java.io.Serializable {

	// Fields

	private String id;
	private String address;
	private Date createdatetime;
	private String idn;
	private Date modifydatetime;
	private String name;
	private String pwd;
	private String rname;
	private Integer state;
	private String tel;
	private Integer type;
	private Set<Taccount> taccounts = new HashSet<Taccount>(0);
	private Set<Ttraderecord> ttraderecords = new HashSet<Ttraderecord>(0);
	private Set<Trole> troles = new HashSet<Trole>(0);

	// Constructors

	/** default constructor */
	public Tuser() {
	}

	/** minimal constructor */
	public Tuser(String id, String name, String pwd) {
		this.id = id;
		this.name = name;
		this.pwd = pwd;
	}

	/** full constructor */
	public Tuser(String id, String address, Date createdatetime, String idn,
			Date modifydatetime, String name, String pwd, String rname,
			Integer state, String tel, Integer type, Set<Taccount> taccounts,
			Set<Ttraderecord> ttraderecords, Set<Trole> troles) {
		this.id = id;
		this.address = address;
		this.createdatetime = createdatetime;
		this.idn = idn;
		this.modifydatetime = modifydatetime;
		this.name = name;
		this.pwd = pwd;
		this.rname = rname;
		this.state = state;
		this.tel = tel;
		this.type = type;
		this.taccounts = taccounts;
		this.ttraderecords = ttraderecords;
		this.troles = troles;
	}

	// Property accessors
	@Id
	@Column(name = "ID", unique = true, nullable = false, length = 36)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "ADDRESS")
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "CREATEDATETIME", length = 0)
	public Date getCreatedatetime() {
		return this.createdatetime;
	}

	public void setCreatedatetime(Date createdatetime) {
		this.createdatetime = createdatetime;
	}

	@Column(name = "IDN")
	public String getIdn() {
		return this.idn;
	}

	public void setIdn(String idn) {
		this.idn = idn;
	}

	@Column(name = "MODIFYDATETIME", length = 0)
	public Date getModifydatetime() {
		return this.modifydatetime;
	}

	public void setModifydatetime(Date modifydatetime) {
		this.modifydatetime = modifydatetime;
	}

	@Column(name = "NAME", unique = true, nullable = false, length = 10)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "PWD", nullable = false, length = 100)
	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	@Column(name = "RNAME", length = 10)
	public String getRname() {
		return this.rname;
	}

	public void setRname(String rname) {
		this.rname = rname;
	}

	@Column(name = "STATE")
	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	@Column(name = "TEL")
	public String getTel() {
		return this.tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	@Column(name = "TYPE")
	public Integer getType() {
		return this.type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "tuser")
	public Set<Taccount> getTaccounts() {
		return this.taccounts;
	}

	public void setTaccounts(Set<Taccount> taccounts) {
		this.taccounts = taccounts;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "tuser")
	public Set<Ttraderecord> getTtraderecords() {
		return this.ttraderecords;
	}

	public void setTtraderecords(Set<Ttraderecord> ttraderecords) {
		this.ttraderecords = ttraderecords;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "tuser_trole", catalog = "jlubank", joinColumns = { @JoinColumn(name = "TUSER_ID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "TROLE_ID", nullable = false, updatable = false) })
	public Set<Trole> getTroles() {
		return this.troles;
	}

	public void setTroles(Set<Trole> troles) {
		this.troles = troles;
	}

}